package service;

import java.io.Serializable;

import javax.persistence.EntityManager;

import util.EMUtil;

public class BaseService<T> implements Serializable {

	/**
	 */
	private static final long serialVersionUID = 1L;
	EntityManager em = EMUtil.getEM();
	
	
	public void save(T t){
		em.getTransaction().begin();
		em.persist(t);
		em.getTransaction().commit();
	}
	
	public void remove(T t){
		em.getTransaction().begin();
		em.remove(t);
		em.getTransaction().commit();
	}
}
